package com.uchiha.nova.core.tool.support;

import cn.hutool.core.date.DatePattern;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import org.apache.ibatis.type.Alias;

import java.time.LocalDateTime;

/**
 * @author 周林静
 * @Date 2021/4/29 15:00
 * @Version 1.0
 */
@Data
@Alias("n_baseEntity")
public class BaseEntity {

    /**
     * id 主键雪花算法id
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;
    /**
     * 备注
     */
    private String remark;
    /**
     * 排序字段
     */
    private Integer sort;
    /**
     * 租户
     */
    private String tenantId;
    /**
     * 公司
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long companyId;
    /**
     * 部门
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long deptId;
    /**
     * 小组或者班组
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long postId;
    /**
     * 创建者
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long createUser;
    /**
     * 创建时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = DatePattern.NORM_DATETIME_PATTERN)
    private LocalDateTime createTime;
    /**
     * 修改者
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long updateUser;
    /**
     * 修改时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = DatePattern.NORM_DATETIME_PATTERN)
    private LocalDateTime updateTime;
    /**
     * 业务状态
     */
    private Integer status;
    /**
     * 逻辑删除
     */
    @TableLogic(value = "0",delval = "1")
    private Integer deleted;
}
